﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using School.Entities;
using School.Common.Reports;

namespace School.Common
{
    public class GenerateReport
    {
        private SchoolEntities db = new SchoolEntities();

        public IEnumerable<SubjectTotal> SuccessStatment(long student)
        {
            return Gradding.GetSubjectsTotal(student, 1);
        }

        public IEnumerable<StudentInformation> StudentInfo(long student)
        {
            List<StudentInformation> rows = new List<StudentInformation>();

            var students = from x in db.TE_Student where x.Id == student select x;

            foreach (var x in students)
            {
                rows.Add(new StudentInformation() { Grade = x.ORG_Grade.Name, StudentName = x.Ar_FirstName + " " + x.Ar_SecondName + " " + x.Ar_ThirdNmae + " " + x.Ar_FourthName });
            }

            return rows;
        }
    }
}
